
package CSS::Preprocessor::Token::Punctuation;

use strict;
use base qw(CSS::Preprocessor::Token);
use fields qw(
    chars
);

use Scalar::Util;

my %instances = ();

sub new {
    my ($class, $chars) = @_;

    return $instances{$chars} if $instances{$chars};

    my $self = $class->CSS::Preprocessor::Token::new();
    $self->{chars} = $chars;

    # Ensure that there's only ever one instance of each symbol
    # loaded, but don't leak memory.
    $instances{$chars} = $self;
    Scalar::Util::weaken($instances{$chars});

    return $self;
}

sub chars {
    return $_[0]->{chars};
}

sub as_string_inner {
    return $_[0]->{chars};
}

1;

